package org.example.campsys.mapper;

import org.apache.ibatis.annotations.*;
import org.example.campsys.model.CourseInfo;
import org.example.campsys.model.LearningInfo;
import org.example.campsys.model.UnitInfo;

import java.util.List;

@Mapper
public interface StudentMapper {

    @Select("select unit_title, doc_path, video_path, unit_introduce, father_id, is_chpt, course_id, learning_score, status from t_course_learn_unit where course_id = #{courseId}")
    List<UnitInfo> selMyUnit(Integer courseId);

    @Update("update t_teaching_student_learning set finished_status = #{finishedStatus}, finished_time = #{finishedTime} where id = #{id}")
    Integer finishStudy(LearningInfo learningInfo);

    @Select("select id, stu_in_class_id, unit_id, finished_status, finished_time from t_teaching_student_learning where stu_in_class_id = #{stuInClassId}")
    List<LearningInfo> selMyTask(Integer stuInClassId);

    @Select("select t_course.id, t_course.course_name, t_course.created_time, t_course.status, t_course.activity_id, t_course.teacher_id, t_course.class_id" +
            " from t_course inner join t_teaching_student_in_class on t_course.class_id = t_teaching_student_in_class.class_id" +
            " where t_teaching_student_in_class.student_id = #{studentId}")
    List<CourseInfo> selMyCourse( Integer studentId);

    @Select("select id from t_manager_student where login_id = #{loginId} ")
    Integer selMyStuId(Integer loginId);
}
